import java.util.Arrays;

public class Solution2 {
    public boolean canPlaceFlowers(int[] flowerbed, int n) {
        int count = 0;
        int[] copy = new int[flowerbed.length + 2];
        System.arraycopy(flowerbed, 0, copy, 1, flowerbed.length);
        // 数组的第一个数字就是 0
        for (int i = 1; i < copy.length - 1 ; i++) {
            if (copy[i-1] == 0 && copy[i] == 0 && copy[i+1] == 0) {
                copy[i] = 1;
                n--;
            }

        }
            return  n <= 0;

    }

}
